package view;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.rmi.RemoteException;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.WindowConstants;
import bean.Cliente;
import rmi.ClienteRMI;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
@SuppressWarnings("serial")
public class ModificarCliente extends javax.swing.JFrame {
	private JLabel jLabel1;
	private JLabel jLabel2;
	private JLabel jLabel3;
	private JButton jButton1;
	private JLabel jLabel5;
	private JTextField jTextNro;
	private JTextField jTextDepto;
	private JLabel jLabel9;
	private JTextField jTextPiso;
	private JLabel jLabel8;
	private JLabel jLabel7;
	private JTextField jTextCalle;
	private JLabel jLabel6;
	private JTextField jTextLocalidad;
	private JTextField jTextDescuento;
	private JLabel jLabel4;
	private JButton jButton2;
	private JTextField jTextTelefono;
	private JTextField jTextNombre;
	private JTextField jTextCodigo;
	
	
	/*public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				ABMCliente inst = new ABMCliente();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}*/
	
	public ModificarCliente() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			this.setTitle("Modificar Cliente");
			{
				jLabel1 = new JLabel();
				getContentPane().add(jLabel1);
				jLabel1.setText("ID de Cliente: ");
				jLabel1.setBounds(29, 43, 84, 16);
			}
			{
				jLabel2 = new JLabel();
				getContentPane().add(jLabel2);
				jLabel2.setText("Nombre: ");
				jLabel2.setBounds(22, 88, 68, 16);
			}
			{
				jLabel3 = new JLabel();
				getContentPane().add(jLabel3);
				jLabel3.setText("Telefono: ");
				jLabel3.setBounds(22, 122, 61, 16);
			}
			{
				jTextCodigo = new JTextField();
				getContentPane().add(jTextCodigo);
				jTextCodigo.setBounds(125, 40, 97, 23);
			}
			{
				jTextNombre = new JTextField();
				getContentPane().add(jTextNombre);
				jTextNombre.setBounds(83, 85, 263, 23);
			}
			{
				jTextTelefono = new JTextField();
				getContentPane().add(jTextTelefono);
				jTextTelefono.setBounds(83, 119, 93, 23);
			}
			{
				jLabel4 = new JLabel();
				getContentPane().add(jLabel4);
				jLabel4.setText("Descuento:");
				jLabel4.setBounds(188, 122, 73, 16);
			}
			{
				jTextDescuento = new JTextField();
				getContentPane().add(jTextDescuento);
				jTextDescuento.setBounds(261, 119, 85, 23);
			}
			{
				jLabel5 = new JLabel();
				getContentPane().add(jLabel5);
				jLabel5.setText("Localidad:");
				jLabel5.setBounds(22, 158, 61, 16);
			}
			{
				jTextLocalidad = new JTextField();
				getContentPane().add(jTextLocalidad);
				jTextLocalidad.setBounds(83, 155, 263, 23);
			}
			{
				jLabel6 = new JLabel();
				getContentPane().add(jLabel6);
				jLabel6.setText("Calle:");
				jLabel6.setBounds(22, 193, 61, 16);
			}
			{
				jTextCalle = new JTextField();
				getContentPane().add(jTextCalle);
				jTextCalle.setBounds(83, 190, 139, 23);
			}
			{
				jLabel7 = new JLabel();
				getContentPane().add(jLabel7);
				jLabel7.setText("Nro.:");
				jLabel7.setBounds(228, 193, 48, 16);
			}
			{
				jTextNro = new JTextField();
				getContentPane().add(jTextNro);
				jTextNro.setBounds(267, 190, 76, 23);
			}
			{
				jLabel8 = new JLabel();
				getContentPane().add(jLabel8);
				jLabel8.setText("Piso:");
				jLabel8.setBounds(22, 227, 61, 16);
			}
			{
				jTextPiso = new JTextField();
				getContentPane().add(jTextPiso);
				jTextPiso.setBounds(83, 224, 93, 23);
			}
			{
				jLabel9 = new JLabel();
				getContentPane().add(jLabel9);
				jLabel9.setText("Departamento:");
				jLabel9.setBounds(183, 227, 93, 16);
			}
			{
				jTextDepto = new JTextField();
				getContentPane().add(jTextDepto);
				jTextDepto.setBounds(279, 224, 64, 23);
			}
			
			{
				jButton1 = new JButton();
				getContentPane().add(jButton1);
				jButton1.setText("Modificar");
				jButton1.setBounds(270, 340, 80, 23);
				jButton1.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {					
						try {
							Cliente cli = new Cliente();
							cli.setId(Integer.parseInt(jTextCodigo.getText()));
							ClienteRMI.getInstance().getIRemota().modificarCliente(cli);
						} catch (RemoteException e) {
							e.printStackTrace();
						}
					}
				});
			}
			{
				jButton2 = new JButton();
				getContentPane().add(jButton2);
				jButton2.setText("Cancelar");
				jButton2.setBounds(270, 340, 80, 23);
				jButton2.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {					
						dispose();
					}
				});
			}
			
			pack();
			this.setSize(400, 418);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
